<?php
/*
  Template Name: politics
 */
?>

<?php
get_header();
?>
<!-- header -->
        
        <div class="container clearfix">
        
        	<div class="rightCol">
                
				<div id="standardPhotosgallery" class="sliderkit photosgallery-std">
					<div class="sliderkit-nav">
						<div class="sliderkit-btn sliderkit-nav-btn sliderkit-nav-prev"><a rel="nofollow" href="#" title="Previous line"><span>Previous line</span></a></div>
						<div class="sliderkit-btn sliderkit-nav-btn sliderkit-nav-next"><a rel="nofollow" href="#" title="Next line"><span>Next line</span></a></div>
						
						<div class="sliderkit-nav-clip">
							<ul>
                            <?php
                        
						$cultureId = get_cat_ID('news');
						$counter = 1;
						$tempContainer = array();
						$args = array('category__and' => array ($cultureId, $cur_cat_id ) , 'numberposts' => 8);
						$innerPosts = get_posts($args);
						foreach ($innerPosts as $innerPost) {
						$colorClassName = 'cpolitices';
						$finalPath = get_the_post_thumbnail($innerPost->ID);
						 $tempContainer[] = array('colorClassName' => $colorClassName, 'imagePath' => $finalPath, 'postTitle' => $innerPost->post_title, 'catName' => 'الثقافة', 'postLink' => get_permalink($innerPost->ID));
						//print_r($tempContainer);
                            ?>
								<li>
                                	<a href="#" rel="nofollow" title="[link title]"><?php echo $finalPath; ?></a>
                                	<span class="politicOverText">
                                    	<span> <?php echo $innerPost->post_title; ?></span>
                                        <span class="POVcontent"><?php echo substr( strip_shortcodes($innerPost->post_content),0,150); ?> </span>  
                                    </span><!-- politicOverText -->
                                </li>
                          <?php $counter++;} ?>
								
							</ul>
						</div><!-- slider-nav-clip -->
					</div><!-- sliderkit-nav -->
                    
					<div class="sliderkit-panels">
                    <?php foreach ($tempContainer as $curInfo) { ?>
						<div class="sliderkit-panel">
                        	<a href="#" class="quickRead"> قراءة سريعه </a>
							<a href="<?php echo $curInfo['postLink'] ?>"><?php echo $curInfo['imagePath'] ?></a>
                            <h2><a href="<?php echo $curInfo['postLink'] ?>"><?php echo $curInfo['postTitle'] ?></a></h2>
						</div><!-- sliderkit-panel -->
                    <?php } ?>
						
					</div><!-- sliderkit-panels -->
				</div><!-- standardPhotosgallery -->
            
            	<div class="homeadvsLeaderBoard"><img src="images/leaderBoard.jpg" alt="" /></div>
                
                <div class="sectionsArea">
                	<!--<div class="sectionsAreaTags clearfix">
                    	<h2> مواضيع ساخنه </h2>
                        <ul>
                        	<li class="active">
                            	<a href="#">سياسة</a>
                                <div class="up-triangle"></div>
                            </li>
                            <li>
                            	<a href="#">الأنتخابات</a>
                                <div class="up-triangle"></div>
                            </li>
                            <li>
                            	<a href="#">السيسى</a>
                                <div class="up-triangle"></div>
                            </li>
                            <li>
                            	<a href="#">المحاكمات</a>
                                <div class="up-triangle"></div>
                            </li>
                            <li>
                            	<a href="#">مصر</a>
                                <div class="up-triangle"></div>
                            </li>
                            <li>
                            	<a href="#">مبارك</a>
                                <div class="up-triangle"></div>
                            </li>
                            <li>
                            	<a href="#">التحرير</a>
                                <div class="up-triangle"></div>
                            </li>                                                   
                        </ul>
                    </div>--><!-- sectionsAreaCategories -->
                    
                    <div class="sectionNewsArea clearfix" id="section-content">
				<?php 
					echo  loadSection(true , $cur_cat_id);	
				?> 
            </div><!-- sectionNewsArea -->               
                    <a href="#" class="seeMoreFromSection load-chosen" id="load-more" sec="<?php echo $cur_cat_id;?>"> شاهد المزيد </a>
                </div><!-- sectionsArea -->
                 
                <div class="newsFromSocial clearfix">
					<?php display_tweets(); ?>
                </div><!-- newsFromSocial -->
                    
                
                <div class="sectionsAreaCategories clearfix">
                <h2>البومات الصور</h2>
                <ul>
                    <?php
                    $albumCatId = get_cat_ID('album');
                    $albums = get_posts(array('category__and' => array ( $albumCatId, $cur_cat_id)));
                    $counter = 1;
                    foreach ($albums as $key => $post) {
                        $colorCategory = getColorClassName($post);
                        $colorClass = 'c' . $colorCategory->slug;
                        if ($key === 0) {
//                            $activeClass = ' active';
                            $firstId = "id='first-album'";
                        } else {
//                            $activeClass = '';
                            $firstId = '';
                        }
                        ?>
                        <li class="<?php echo $colorClass; ?> album-act">
                            <a href="#" class="fetch-album" pid="<?php echo $post->ID; ?>" <?php echo $firstId ?>><?php echo $post->post_title; ?></a>
                            <div class="up-triangle"></div>
                        </li>
                        <?php
//                        $counter++;
                    }
                    ?>                                                   
                </ul>
            </div><!-- homePhotoGalleries -->
            <div class="photoAlbums" id="album-container" style="display: none;">

            </div>
                
            </div><!-- rightCol -->
            
            <div class="sideBar">
            	
                <div class="importantNewsArea">
            <ul class="importantNewsTab clearfix">
                <li class="active">
                    <h2><a href="#theLatestNews">أحدث الأخبار</a></h2>
                    <div class="up-triangle"></div>
                </li>
                <li>
                    <h2><a href="#mostViews">الأخبار الأكثر أنتشارا</a></h2>
                    <div class="up-triangle"></div>
                </li>   
            </ul>

            <div class="importantNewsPosts" id="theLatestNews">
                <div class="scroll-pane">
                    <ul>
                        <?php
                        $newsCatId = get_cat_ID('news');
                        $posts = get_posts(array('category' => $newsCatId, 'numberposts' => 8));
                        $counter = 1;
                        foreach ($posts as $post) {
                            $colorCategory = getColorClassName($post);
                            $colorClassName = 'c' . $colorCategory->slug;
                            ?>
                            <li class="<?php echo $colorClassName; ?>">
                                <span><?php echo $counter; ?></span>
                                <h3><a href="#"><?php echo $post->post_title; ?></a></h3>
                            </li>
                            <?php
                            $counter++;
                        }
                        ?>
                    </ul>
                </div><!-- scroll-pane -->
            </div><!-- importantNewsPosts -->

            <div class="importantNewsPosts" id="mostViews">
                <div class="scroll-pane">
                    <ul>
                        <?php
                        $query = new WP_Query(array('cat' => $newsCatId, 'numberposts' => 8, 'meta_key' => '_count-views_all', 'orderby' => 'meta_value_num'));
                        while ($query->have_posts()) {
                            $query->the_post();
                            $colorCategory = getColorClassName(get_the_ID());
                            $colorClassName = 'c' . $colorCategory->slug;
                            $meta_values = get_post_meta(get_the_ID(), '_count-views_all', TRUE);
                            ?>
                            <li class="<?php echo $colorClassName; ?>">
                                <span><?php echo $meta_values; ?></span>
                                <h3><a href="<?php the_permalink(); ?>"><?php echo substr(get_the_title(), 0, 250); ?></a></h3>
                            </li>
                            <?php
                        }
                        wp_reset_postdata();
                        ?>
                    </ul>
                </div><!-- scroll-pane -->
            </div><!-- importantNewsPosts -->

        </div><!-- imprtantNewsArea -->
                
                <?php get_sidebar(); ?>
    </div><!-- sideBar -->

</div><!-- container -->
<?php get_footer(); ?>
<script type="text/javascript">!function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (!d.getElementById(id)) {
            js = d.createElement(s);
            js.id = id;
            js.src = "//platform.twitter.com/widgets.js";
            fjs.parentNode.insertBefore(js, fjs);
        }
    }(document, "script", "twitter-wjs");</script>